package com.jueling.culture.util;

/**
 * @author by linp
 * @date 2020/11/12
 */
public class RedisKeyGeneratorUtil {

    /** 过期时间*/
    public static final long EXPIRED_TIME_300L = 5 * 60L;

    public static final long EXPIRED_TIME_1800L = 30 * 60L;

    private static final String ACCESS_TOKEN_REDIS_KEY = "yibai:access:{phone}";

    /**
     * 后台登录验证码
     */
    public static final String LOGIN_CODE = "yibai:backstage:login:code:";


    /**
     * accessToken
     *
     * @param phone
     * @return
     */
    public static String accessTokenRedisKeyGenerator(String phone) {
        return ACCESS_TOKEN_REDIS_KEY.replace("{phone}", phone);
    }

    /**
     * 验证码对应的redis key
     * @return
     */
    public static String genVerificationCodeKey(String key) {
        return RedisKeyGeneratorUtil.LOGIN_CODE + key;
    }
}
